#

| Chapter 17 Finding Files with find |

## 17.13 Searching for Files by Type

If you are only interested in files of a certain type, use the -type argument, followed by one of the characters in Table 17.1 [some versions of find don't have all of these -JP ].

Table 17.1: find -type Characters
`Character` | `Meaning`
--- | ---
b | Block special file ("device file")
c | Character special file ("device file")
d | Directory
f | Plain file
l | Symbolic link
p | Named pipe file
s | Socket

Unless you are a system administrator, the important types are directories, plain files, or symbolic links (i.e., types `d`, `f`, or `l`).

Using the -type operator, another way to list files recursively is:

    xargs
     % find . -type f -print | xargs ls -l

It can be difficult to keep track of all the symbolic links in a directory. The next command will find all the symbolic links in your home directory and print the files that your symbolic links point to. [`$NF` gives the last field of each line, which holds the name a symlink points to. -JP] If your find doesn't have a -ls operator, pipe to xargs ls -l as above.

>     % find $HOME -type l -ls | awk '{print $NF}'

- BB

17.12 Finding Many Things with One Command |  | 17.14 Searching for Files by Size